﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using HWmanagementDB;

namespace HWmanagementServer
{
    [DataContract]
    public class HomeworkDoneModel
    {
        [DataMember]
        public int id;
        [DataMember]
        public int homeworkid;
        [DataMember]
        public string userid;
        [DataMember]
        public int fileid;
        [DataMember]
        public int version;

        public static HOMEWORKDONE toDBTable(HomeworkDoneModel hwdm)
        {
            return new HOMEWORKDONE() { ID = hwdm.id, USERID = hwdm.userid, FILEID = hwdm.fileid, HOMEWORKID = hwdm.homeworkid, VERSION = hwdm.version };
        }

        public static HomeworkDoneModel fromDBTable(HOMEWORKDONE hd)
        {
            return new HomeworkDoneModel() { id = hd.ID, homeworkid = hd.HOMEWORKID, userid = hd.USERID, fileid = (int)hd.FILEID, version = hd.VERSION };
        }
    }
}
